// Fill out your copyright notice in the Description page of Project Settings.

#include "ClientNet.h"
#include "PacketFactory.h"
#include "CommonFunction.h"
#include "test.pb.h"

template <> PacketFactory* Singleton< PacketFactory >::pInstance = new PacketFactory();

PacketFactory::PacketFactory()
{
}

PacketFactory::~PacketFactory()
{
}

Packet* PacketFactory::CreatePacket(int16 id)
{
	if (id < 0)
	{
		return nullptr;
	}

	Packet *pPacket = new Packet();
	pPacket->mPacketID = id;
	switch (id)
	{
	case 0:
	{
		pPacket->mMessage = new CG_LOGIN();
		break;
	}
	default:
		SAFE_DELETE(pPacket);
		return nullptr;
	}

	return pPacket;
}
